package com.example.designpatterns.adapter.objectadapter;

import com.example.designpatterns.adapter.classadapter.OurFriend;

/**
 * 测试
 */
public class Person {
    public void speakTo(OurFriend friend) {
        System.out.println("人：你在干嘛？");
        friend.speak();
    }

    public static void main(String[] args) {
        // 一个人
        Person person = new Person();
        // 一只狗
        IAnimal dog = new Dog();
        // 一只猫
        IAnimal cat = new Cat();
        // 万物拟人
        person.speakTo(new AnimalFriendAdaper(dog));
        person.speakTo(new AnimalFriendAdaper(cat));

    }
}

